package com.baoyouqun.controller.weixin;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.StpUtil;
import com.alibaba.cola.dto.SingleResponse;
import com.baoyouqun.domain.VO.UserVipTimeVO;
import com.baoyouqun.service.UserVipTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("wx/userVipTime")
@Api(tags = "用户VIP时间表管理接口")
public class WxUserVipTimeController {

    @Resource
    private UserVipTimeService userVipTimeService;

    @SaIgnore
    @GetMapping("getById")
    @ApiOperation("查询用户VIP信息")
    public SingleResponse<UserVipTimeVO> selectByUserId() {
        if (!StpUtil.isLogin()) {
            return SingleResponse.of(null);
        }
        String userId = StpUtil.getLoginIdAsString();
        return SingleResponse.of(userVipTimeService.selectByUserId(userId));
    }


}